home *** CD-ROM | disk | FTP | other *** search
/ Apple Service Source 1996 February / Service Source 2.0 1996 Companion.iso / AppleOrder / Program / AppleOrder CCL Folder / Practical Peripheral V.42.CCL < prev    next >
Encoding:
Text File  |  1992-09-18  |  21.3 KB  |  663 lines  |  [TEXT/MPS ]

  1. !
  2. ! Practical Peripherals V.42 9600 CCL script (Hardware MNP)
  3. !
  4. !    Change History-
  5. !        v1.0.1ß1    11/28/90    gs:Created CCL
  6. !        v1.0.2        12/07/90    gs:Added bug fix for Printer Port ~MPRT selection
  7. !
  8. !    The following label ranges (0-255) are defined for all scripts:
  9. !
  10. !    Label        Function
  11. !    -----        --------
  12. !    0-19        Communications Setup
  13. !    20-39        Get a Modem (IBX switch thru)
  14. !    40-59        Modem Setup
  15. !    60-79        Dialing
  16. !    80-99        Physical Connection
  17. !    100-119        GEIS Logon
  18. !    120-139        CICS
  19. !    140-159        APPM
  20. !    160-179        Online
  21. !    180-199        Terminate Session
  22. !    200-209        Cancel
  23. !    210-219        Hangup
  24. !    230-239        <UNUSED>
  25. !    240-255        Disconnect
  26. !
  27. !    Note:        Label 210 is the modem hangup sequence
  28. !                Label 240 is reserved as the start of the disconnect sequence
  29. !
  30. !================================================================================
  31. -LABEL 0    !***<Physical connection entry point>*** Initialize Communications
  32. !================================================================================
  33. !
  34. !    Set the Baud, Data, Stop, and Parity bits
  35. SerReset ~Baud ~Prty ~Xbts ~Sbts
  36. CTBParameter Port "~MPrt" 13
  37. !
  38. !    CTBOPEN [<LabelIfOpenFails>] [<LabelIfError>]
  39. CTBOpen 14 15        ! Open the Communications session
  40. !
  41. !    Flush any data, Initialize script variables and define Cancel label
  42. Flush                ! clear input buffer and ring buffer
  43. CanBtn 200            ! If user cancels, take the error return
  44. !
  45. SetVar 1 0            ! #of consecutive no responses to hangup command
  46. SetVar 2 0            ! #of consecutive no responses to modem configuration command
  47. SetVar 3 0            ! #of consecutive network contact failures.
  48. SetVar 4 0            ! #of logon validation failures
  49. SetVar 5 0            ! #of consecutive CICS90  failures
  50. SetVar 6 0            ! #of consecutive APPM failures
  51. SetVar 7 0            ! flag to indicate if connecting(0) or disconnecting(1)
  52. SetVar 8 0            ! not used
  53. !
  54. Jump 20                ! Go to Modem Selection and Setup
  55. !
  56. !*********
  57. -LABEL 13    !---<CTBParameter Port failed>---
  58. !*********
  59. Alert -1 CTBParameter Port caused an error.
  60. Exit -1                ! exit the script with an error.
  61. !
  62. !*********
  63. -LABEL 14    !---<CTBOpen failed>---
  64. !*********
  65. Alert -1 CTBOpen could not open communications.\13The serial port may already be in use.
  66. Exit -1                ! exit the script with an error.
  67. !
  68. !**********
  69. -LABEL 15    !---<CTBOpen err>---
  70. !**********
  71. Alert -1 CTBOpen caused an Communications Toolbox error.
  72. Exit -1                ! exit the script with an error.
  73. !
  74. !================================================================================
  75. -LABEL 20    !***<Modem Selection>*** Select modem through IBX switch
  76. !================================================================================
  77. !
  78. !================================================================================
  79. -LABEL 40    !***<Modem Setup>*** Modem Reset and Setup
  80. !================================================================================
  81. DsplyPic 1
  82. DsplyMsg Making sure the modem is ready.
  83. Jsr 210                ! Hang up (just in case)
  84. SetVar 1 0            ! clear # hangup tries counter
  85. !
  86. !**********
  87. -LABEL 42    ! ---<Got modem attention>---
  88. !**********
  89. DsplyMsg Setting modem parameters.
  90. !    Clear all previous MatchStr's and setup the modem
  91. MatchStr 1 42 Dummy
  92. Wait 30                ! Give modem .5 second to get ready before sending the attention chars
  93. Xmit AT
  94. !    Send MNP Compatible modem commands
  95. Wait 3                ! Pause before "stop forcing CD and DTR" command
  96. Xmit &c1&d2
  97. Wait 3                ! Pause before set "Xon/Xoff" flow control
  98. Xmit &k2
  99. Wait 3                ! Pause before selecting Error Control xmission mode
  100. Xmit &Q5
  101. Wait 3                ! Pause before reporting DCE (modem to modem) speed
  102. Xmit W2
  103. Wait 3                ! Pause before response with correction, compression, and speed of msg
  104. Xmit S95=44
  105. ! This should be AT&C1&D2&K2&Q5W2S95=44
  106. Flush                ! clear input buffer and send Carriage Return (CR)
  107. Xmit \13
  108. !
  109. !    Look for one of the following expected responses
  110. MatchStr 1 60 OK
  111. Wait 180               ! wait 3 secs
  112. IncVar 2            ! increment # modem setup tries
  113. IfVar 2 3 44        ! if 3 tries, display Modem Configuration Alert
  114. DsplyMsg Modem does not respond to setup commands. Retrying ...
  115. Jump 42                ! else try modem setup again
  116. !
  117. !**********
  118. -LABEL 44    ! ---<Modem configuration err>---
  119. !**********
  120. Bell
  121. Alert 200 The modem is not responding to setup commands.\13Turn the modem off and then on again before retrying.
  122. SetVar 2 0            ! clear # modem setup tries
  123. Jump 40                ! reset modem and try again
  124. !
  125. !================================================================================
  126. -LABEL 60    !***<Modem ready>*** Dial phone
  127. !================================================================================
  128. DsplyMsg Dialing ~Fone ...
  129. DsplyPic 2
  130. !    Clear all previous MatchStr's (No comments on same line as MatchStr's)
  131. MatchStr 1 60 Dummy
  132. SetVar 2 0            ! clear #modem setup tries
  133. !    Turn off Xon/Xoff flow control
  134. CTBParameter Handshake XON/XOFF 78
  135. Wait 30                ! Give modem .5 secs to get ready before sending the attention chars
  136. Xmit AT
  137. Wait 3                ! Pause before "tone dial" command
  138. Xmit D~Tone
  139. Wait 3                ! Pause before phone number
  140. Xmit ~Fone
  141. Wait 3
  142. Flush                ! clear input buffer and send CR
  143. Xmit \13
  144. !
  145. !    Look for one of the following expected responses
  146. MatchStr 1 80 CONNECT ~Baud
  147. MatchStr 2 66 NO CARRIER
  148. MatchStr 3 70 BUSY
  149. MatchStr 4 74 NO DIAL
  150. MatchStr 5 62 ERROR
  151. Wait 2100            ! wait 35 secs
  152. !
  153. !**********
  154. -LABEL 62    !---<No response or ERROR from modem>---
  155. !**********
  156. IncVar 3            ! Increment # dial attempts counter
  157. IfVar 3 4 64        ! if 4 attempts, display No Dial Response Alert
  158. DsplyMsg Modem does not respond to Dial command. Retrying ...
  159. Jump 40                ! reset modem and try again
  160. !
  161. !**********
  162. -LABEL 64    !---<No dial response err>---
  163. !**********
  164. Bell
  165. Alert 200 The modem is not responding to dial command.\13Make sure your modem is connected to a phone line.
  166. SetVar 3 0            ! clear # dial attempts counter
  167. Jump 40                ! reset modem and try again
  168. !
  169. !**********
  170. -LABEL 66   !---<No Carrier>---
  171. !**********
  172. IncVar 3            ! Increment # dial attempts counter
  173. IfVar 3 4 68        ! if 4 attempts, display No Carrier Alert
  174. DsplyMsg No Carrier with phone number dialed. Retrying ...
  175. Jump 40                ! reset modem and try again
  176. !
  177. !**********
  178. -LABEL 68    !---<No carrier err>---
  179. !**********
  180. Bell
  181. Alert 200 Cannot detect carrier signal after dialing.\13Make sure the phone number provided is correct.
  182. SetVar 3 0            ! clear # dial attempts counter
  183. Jump 40                ! reset modem and try again
  184. !
  185. !**********
  186. -LABEL 70    !---<busy>---
  187. !**********
  188. IncVar 3            ! Increment # dial attempts counter
  189. IfVar 3 4 72        ! if 4 attempts, display Busy Alert
  190. DsplyMsg Phone number dialed is busy. Pause  before retrying.
  191. Wait 300            ! wait 5 secs
  192. DsplyMsg Phone number dialed is busy. Retrying ....
  193. Jump 40                ! reset modem and try again
  194. !
  195. !**********
  196. -LABEL 72    !---<Busy err>---
  197. !**********
  198. Bell
  199. Alert 200 All network access lines are in use.\13Try again later.
  200. SetVar 3 0            ! clear # dial attempts counter
  201. Jump 40                ! reset modem and try again
  202. !
  203. !**********
  204. -LABEL 74    !---<No Dialtone>---
  205. !**********
  206. IncVar 3            ! Increment # dial attempts counter
  207. IfVar 3 4 76        ! if 4 attempts, display No Dialtone Alert
  208. DsplyMsg Modem reports no dial tone. Retrying ...
  209. Jump 40                ! reset modem and try again
  210. !
  211. !**********
  212. -LABEL 76   !---<No dialtone Error>---
  213. !**********
  214. Bell
  215. Alert 200 Modem reports no dial tone.\13Make sure your modem is connected to a phone line.
  216. SetVar 3 0            ! clear # dial attempts counter
  217. Jump 40                ! reset modem and try again
  218. !
  219. !*********
  220. -LABEL 78    !---<CTBParameter XON/XOFF failed>---
  221. !*********
  222. Alert -1 CTBParameter XON/XOFF caused an error.
  223. Exit -1                ! exit the script with an error
  224. !
  225. !================================================================================
  226. -LABEL 80    !***<Establish Physical Connection>*** Send H's to identify us to network
  227. !================================================================================
  228. DsplyMsg Requesting network attention
  229. !    Look for one of the following expected responses
  230. MatchStr 1 84 NO CARRIER
  231. MatchStr 2 100 U#
  232. Wait 12                ! Wait 0.2 sec before sending the first H
  233. Xmit H
  234. Wait 21                ! Wait another 0.35 sec before sending the second H
  235. Xmit H
  236. Wait 600            ! Allow 10 seconds for the U# to show up
  237. IncVar 3            ! No U#, increment # dial attempts counter
  238. IfVar 3 4 82        ! if 4 attempts, display No U# Alert
  239. DsplyMsg Unable to get network attention. Retrying ...
  240. Jump 40                ! reset modem and try again
  241. !
  242. !**********
  243. -LABEL 82    !---<No U#>---
  244. !**********
  245. Bell
  246. Alert 200 Unable to get the network's attention.\13Make sure you have the correct phone number.
  247. SetVar 3 0            ! clear # dial attempts counter
  248. Jump 40                ! reset modem and try again
  249. !
  250. !**********
  251. -LABEL 84    !---<Line dropped>---
  252. !**********
  253. IncVar 3            ! Increment # dial attempts counter
  254. IfVar 3 4 86        ! if 4 attempts, display Line Dropped Alert
  255. DsplyMsg Carrier signal dropped before network recognition. Retrying ...
  256. Jump 40                ! reset modem and try again
  257. !
  258. !**********
  259. -LABEL 86   !---<Line dropped Err>---
  260. !**********
  261. Bell
  262. Alert 200 Carrier signal dropped before network recognition.\13Try again.
  263. SetVar 3 0            ! clear # dial attempts counter
  264. Jump 40                ! reset modem and try again
  265. !
  266. !================================================================================
  267. -LABEL 100    !***<GEIS logon>***
  268. !================================================================================
  269. !
  270. DsplyMsg Physical Connection established. Logging on to network ...
  271. DsplyPic 3
  272. SetVar 3 0            ! clear # dial attempts counter
  273. Wait 6                ! wait 0.1 sec
  274. Flush                ! clear input buffer
  275. !    Note: leave 2 spaces between ~Dist and ~Numb
  276. Xmit ~User,~Dist  ~Numb,~Ridn\13
  277. !
  278. !    Look for one of the following expected responses
  279. MatchStr 1 104 NO CARRIER
  280. MatchStr 2 106 DISCONNECTED
  281. MatchStr 3 120 ===>
  282. MatchStr 4 114 UNAVAIL
  283. !    MatchStr 5 ??? INTERRUPT
  284. MatchStr 6 108 N FAULT,
  285. MatchStr 7 108 T FORMAT,
  286. MatchStr 8 110 L DENIED
  287. MatchStr 9 112 BUSY
  288. MatchStr 10 112 DOWN
  289. Wait 4200            ! wait up to 70 seconds for a response
  290. IncVar 4            ! Increment # logon attempts counter
  291. IfVar 4 3 102        ! if 3 tries, display No Login Response alert 
  292. DsplyMsg No logon response from network. Retrying ...
  293. Jump 40                ! reset modem and try again
  294. !
  295. !*********
  296. -LABEL 102    !---<No Logon response>---
  297. !*********
  298. Bell
  299. Alert 200 No logon response from network.\13Try again.
  300. SetVar 4 0            ! clear # logon attempts counter
  301. Jump 40                ! reset modem and try again
  302. !
  303. !*********
  304. -LABEL 104    !---<Carrier dropped>---
  305. !*********
  306. IncVar 4            ! Increment # login attempts counter
  307. IfVar 4 3 105        ! if 3 attempts, display Carrier dropped alert
  308. DsplyMsg Carrier signal dropped during network logon. Retrying ...
  309. Jump 40                ! reset modem and try again
  310. !
  311. !*********
  312. -LABEL 105    !---<Carrier dropped Err>---
  313. !*********
  314. Bell
  315. Alert 200 Carrier signal dropped during network logon.\13Try again.
  316. SetVar 4 0            ! clear # logon attempts counter
  317. Jump 40                ! reset modem and try again
  318. !
  319. !*********
  320. -LABEL 106    !---<Session disconnected>---
  321. !*********
  322. IncVar 4            ! Increment # logon attempts counter
  323. IfVar 4 3 107        ! if 3 attempts, display Session disconnected alert
  324. DsplyMsg Network connection dropped during network logon. Retrying ...
  325. Jump 40                ! reset modem and try again
  326. !
  327. !*********
  328. -LABEL 107    !---<Session disconnected Err>---
  329. !*********
  330. Bell
  331. Alert 200 Network connection dropped during network logon.\13Try again.
  332. SetVar 4 0            ! clear # logon attempts counter
  333. Jump 40                ! reset modem and try again
  334. !
  335. !*********
  336. -LABEL 108    !---<Validation fault>---
  337. !*********
  338. IncVar 4            ! Increment # logon attempts counter
  339. IfVar 4 3 109        ! see if limit of 3 is exceeded.
  340. DsplyMsg Network rejected your identification. Retrying ...
  341. Wait 60                ! wait 1 sec
  342. Jump 100            ! retry GEIS login (only case where we don't reset)
  343. !
  344. !*********
  345. -LABEL 109    !---<validation fault err>---
  346. !*********
  347. Bell
  348. Alert 200 Your network identification has been rejected.\13Check Setup to make sure your identification is correct.
  349. SetVar 4 0            ! clear # logon attempts counter
  350. Jump 40                ! reset modem and try again
  351. !
  352. !*********
  353. -LABEL 110    !---<Denied by host>---
  354. !*********
  355. IncVar 4            ! Increment # logon attempts counter
  356. IfVar 4 3 111        ! if 3 attempts, display Network Problem alert
  357. DsplyMsg Network host equipment problem detected. Retrying ...
  358. Jump 40                ! reset modem and try again
  359. !
  360. !*********
  361. -LABEL 111    !---<Denied by host err>---
  362. !*********
  363. Bell
  364. Alert 200 Network host equipment problem detected.\13Try again.
  365. SetVar 4 0            ! clear # logon attempts counter
  366. Jump 40                ! reset modem and try again
  367. !
  368. !*********
  369. -LABEL 112    !---<MARK3K access busy/down>---
  370. !*********
  371. IncVar 4            ! Increment # logon attempts counter
  372. IfVar 4 3 113        ! if 3 attempts, display Network Busy alert
  373. DsplyMsg Network equipment busy/down. Retrying ...
  374. Jump 40                ! reset modem and try again
  375. !
  376. !*********
  377. -LABEL 113    !---<MARK3K access busy/down err>---
  378. !*********
  379. Bell
  380. Alert 200 Network equipment busy or down.\13Try again.
  381. SetVar 4 0            ! clear # logon attempts counter
  382. Jump 40                ! reset modem and try again
  383. !
  384. !*********
  385. -LABEL 114    !---<Network unavailable>---
  386. !*********
  387. IncVar 4            ! Increment # logon attempts counter
  388. IfVar 4 3 115        ! if 3 attempts, display Network Unavailable alert
  389. DsplyMsg Network unavailable message received. Retrying ...
  390. Jump 40                ! reset modem and try again
  391. !
  392. !*********
  393. -LABEL 115    !===<Network unavailable err>===
  394. !*********
  395. Bell
  396. Alert 200 The network is not available at the moment.\13If the problem continues, contact the Apple USA helpline.
  397. SetVar 4 0            ! clear # logon attempts counter
  398. Jump 40                ! reset modem and try again
  399. !
  400. !================================================================================
  401. -LABEL 120    !***<MARK3000 prompt>*** Invoke CICS
  402. !================================================================================
  403. !
  404. DsplyMsg Requesting access to network subsystem ...
  405. DsplyPic 4
  406. Wait 6                ! wait 0.1 secs
  407. Flush                ! clear input buffer
  408. !
  409. Xmit ~CICS\13
  410. !    Look for one of the following expected responses
  411. MatchStr 3 140 READY
  412. !    To overcome a network problem, the following label was changed from 124 to 126
  413. !    MatchStr 4 124 T BOUND
  414. MatchStr 4 126 T BOUND
  415. MatchStr 5 126 UNRECOGN
  416. MatchStr 6 126 ===>
  417. Wait 3600            ! Allow 60 secs for the expected responses to show up
  418. IncVar 5            ! Timeout, so increment # CICS tries counter
  419. IfVar 5 2 122        ! if 3 tries, display No Response alert
  420. DsplyMsg No response to network subsystem request. Retrying ...
  421. Jump 40                ! reset modem and try again
  422. !
  423. !*********
  424. -LABEL 122    !---<No CICS err>---
  425. !*********
  426. Bell
  427. Alert 200 No response to network subsystem request.\13Try again.
  428. SetVar 5 0            ! clear # CICS tries counter
  429. Jump 40                ! reset modem and try again
  430. !
  431. !*********
  432. -LABEL 124    !---<Session not bound err>---
  433. !*********
  434. Bell
  435. Alert 200 Network CICS subsystem needs to be started.\13Please contact the Apple USA helpline immediately.
  436. Jump 200            ! jump to cancel routine
  437. !
  438. !*********
  439. -LABEL 126    !---<Invalid application>---
  440. !*********
  441. IncVar 5            ! Increment # CICS tries counter
  442. IfVar 5 3 127        ! if 3 tries, display Invalid Application alert
  443. DsplyMsg Network subsystem request has been rejected. Retrying ...
  444. Wait 60                ! wait 1 sec
  445. Flush
  446. Jump 120            ! try to access CICS again
  447. !
  448. !*********
  449. -LABEL 127    !---<Invalid application err>---
  450. !*********
  451. Bell
  452. Alert 200 The network subsystem request has been rejected.\13Try again.
  453. SetVar 5 0            ! clear # CICS tries counter
  454. Flush
  455. Jump 40                ! reset modem and try again
  456. !
  457. !================================================================================
  458. -LABEL 140    !***<CICS ready>*** Start APPM transaction
  459. !================================================================================
  460. !
  461. DsplyMsg Requesting access to distribution center ~Dist ...
  462. DsplyPic 5            ! Highlight box 5 on screen
  463. SetVar 5 0            ! clear # CICS tries counter
  464. !                    ! Send what needs to be sent
  465. Xmit ~Epgm~Dist\13
  466. !    Look for one of the following expected responses
  467. Wait 12                ! wait 0.2 secs
  468. Flush                ! clear input buffer
  469. !    Look for one of the following expected responses
  470. MatchStr 3 160 C100
  471. MatchStr 4 144 INVALID
  472. Wait 3600            ! Allow 60 secs for the expected responses to show up
  473. !
  474. IncVar 6            ! Timeout, so Increment # APPM tries counter
  475. IfVar 6 2 142        ! if 2 tries, display No Transaction alert
  476. DsplyMsg No response to distribution center access request. Retrying ...
  477. Jump 40                ! reset modem and try again
  478. !
  479. !*********
  480. -LABEL 142    !---<No transaction response>---
  481. !*********
  482. Bell
  483. Alert 200 No response to distribution center access.\13Try again.
  484. SetVar 6 0            ! reset # APPM tries counter
  485. Jump 40                ! reset modem and try again
  486. !
  487. !*********
  488. -LABEL 144    !---<Invalid transaction>---
  489. !*********
  490. IncVar 6            ! Increment # APPM tries counter
  491. IfVar 6 2 145        ! if 2 tries, display Invalid Transaction alert
  492. DsplyMsg Distribution center access request rejected. Retrying ...
  493. Jump 40                ! reset modem and try again
  494. !
  495. !*********
  496. -LABEL 145    !---<Invalid transaction err>---
  497. !*********
  498. Bell
  499. Alert 200 Distribution center access request rejected.\13Check Setup to make sure your identification is correct.
  500. SetVar 6 0            ! reset # APPM tries counter
  501. Jump 40                ! reset modem and try again
  502. !
  503. !================================================================================
  504. -LABEL 160    !***<Online>***
  505. !================================================================================
  506. !
  507. Wait 60                ! wait 1 sec
  508. DsplyMsg Accessing the distribution center ~Dist ...
  509. DsplyPic 6            ! Highlight box 6 on screen
  510. !    C9 = pass msg thru GE, 899 = Echo cmd
  511. Xmit C9899Ole\13
  512. !    Look for one of the following expected responses
  513. MatchStr 2 162 C5
  514. MatchStr 3 170 Ole\13
  515. Wait 7200            ! wait 2 minutes for echo back or distribution center nonavail msg
  516. !
  517. !*********
  518. -LABEL 162    !---<no luck this time>--- 
  519. !*********
  520. DsplyMsg Distribution center is not available ...
  521. Jsr 180                ! terminate session
  522. Bell
  523. Alert -1 Distribution center is not available.\13Please try again later.
  524. Jump 200            ! exit to Cancel routine
  525. !
  526. !*********
  527. -LABEL 170    !---<Success, we’re in, so exit>--- 
  528. !*********
  529. Wait 30                ! wait 0.5 secs
  530. Flush                ! clear input buffer
  531. Exit 0                ! exit the script normally
  532. !
  533. !================================================================================
  534. -LABEL 180-199    !***<Terminate Session>***
  535. !================================================================================
  536. !
  537. !*********
  538. -LABEL 180    !---<Terminate session>--- 
  539. !*********
  540. !    send Abnormal disconnect command
  541. Xmit C3\13
  542. !    Look for one of the following expected responses
  543. MatchStr 1 182 U#
  544. Wait 300            ! wait 5 secs
  545. Return
  546. !
  547. !*********
  548. -LABEL 182    !---<Say bye>---
  549. !*********
  550. Wait 6                ! wait 0.1 sec and sign off the network
  551. Xmit BYE\13
  552. Return
  553. !
  554. !================================================================================
  555. -LABEL 200    !***<Cancel Routine>***
  556. !================================================================================
  557. DsplyMsg Canceling ...
  558. Flush
  559. Wait 30                ! wait 0.5 secs
  560. Exit -1                ! exit the script with an error
  561. !
  562. !================================================================================
  563. -LABEL 210    !***<Hang up phone Routine>***
  564. !================================================================================
  565. !
  566. !    Look for one of the following expected responses
  567. MatchStr 1 222 CARRIER
  568. SetVar 1 0            ! clear # hangup tries counter
  569. SetVar 2 0            ! clear # modem config tries counter and reuse for MNPStatus checks
  570. !
  571. !*********
  572. -LABEL 220    !---<Hang up the phone subroutine>---
  573. !*********
  574. Wait 60                ! wait 1 sec (beginning guard time) and send +++ (escape)
  575. Xmit +
  576. Xmit +
  577. Xmit +
  578. Wait 60                ! wait 1 more sec (end guard time)
  579. Flush                ! clear input buffer and tell modem to hang up verbosely
  580. Xmit ATV1H\13
  581. !    Look for one of the following expected responses
  582. MatchStr 2 222 OK
  583. MatchStr 3 224 ERROR
  584. Wait 120            ! wait 2 secs
  585. Jump 224            ! test for error or no response            
  586. !
  587. !*********
  588. -LABEL 222    !---<Reset the modem>---
  589. !*********
  590. !
  591. IfVar 7 0 229        ! If NOT disconnecting, bypass the modem reset.
  592. !                      This aids in script debugging so we dont reset modem 1st time.
  593. Flush                ! Flush the buffer and send Hayes Reset Modem command
  594. Xmit ATZ\13
  595. !    Look for one of the following expected responses
  596. MatchStr 2 229 OK
  597. MatchStr 3 224 ERROR
  598. Wait 180            ! wait 3 secs
  599. !
  600. !*********
  601. -LABEL 224    !---<Error or just no response>---
  602. !*********
  603. IncVar 1            ! Increment # hangup tries counter
  604. IfVar 1 3 225        ! if 3 tries, display error alert and try again
  605. Jump 220            ! try to hangup again
  606. !
  607. !*********
  608. -LABEL 225    !---<Error>---
  609. !*********
  610. IfVar 7 1 229        ! If disconnecting, just return.
  611. Alert 200 The modem is not responding to the hangup command.\13Turn it off and then on again before retrying.
  612. SetVar 1 0            ! clear # hangup tries counter
  613. Jump 220            ! try to hangup again
  614. !
  615. !*********
  616. -LABEL 229    !---<Return from the Hangup sequence>---
  617. !*********
  618. Wait 60                ! wait 1 sec
  619. Flush                ! clear input buffer
  620. Return
  621. !
  622. !================================================================================
  623. -LABEL 230-239    !***<UNUSED>***
  624. !================================================================================
  625. !
  626. !================================================================================
  627. -LABEL 240    !***<Disconnection Sequence>***
  628. !================================================================================
  629. !
  630. !    If the connection is closed, we cant hangup, so just exit
  631. !    CTBIFCLOSED <LabelToGotoIfConnectionClosed>
  632. CTBIFCLOSED 246
  633. !
  634. SetVar 7 1            ! We're disconnecting, so set the flag
  635. !    Look for one of the following expected responses
  636. MatchStr 1 242 U#
  637. MatchStr 2 244 NO CARRIER
  638. Wait 60                ! wait 1 sec
  639. Jump 244            ! and hang up the phone
  640. !
  641. !*********
  642. -LABEL 242    !---<Sign off the network>---
  643. !*********
  644. Xmit BYE\13
  645. Wait 120            ! wait 2 secs
  646. !
  647. !*********
  648. -LABEL 244    !---<Hang up the phone>---
  649. !*********
  650. SetVar 1 0            ! clear the # hangup tries counter
  651. Jsr 210                ! Execute the Hang-up subroutine
  652. !    No CTBClose here because the connection is closed externally from the script
  653. !    in case we exited the script with an error before completion.
  654. Flush                ! clear input buffer
  655. Exit 0                ! exit the script normally
  656. !
  657. !*********
  658. -LABEL 246    !---<Connection Was Closed>---
  659. !*********
  660. Flush                ! clear input buffer
  661. Exit 0                ! exit the script normally
  662. ###
  663.